package com.lagou.demo.controller;

import com.lagou.demo.service.IDemoService;
import com.lagou.edu.mvcFramework.annotations.MyAutowired;
import com.lagou.edu.mvcFramework.annotations.MyController;
import com.lagou.edu.mvcFramework.annotations.MyRequestMapping;
import com.lagou.edu.mvcFramework.annotations.Security;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author stevejson
 */
@MyController
@MyRequestMapping("/demo")
@Security({"luohq"})
public class DemoController {

    @MyAutowired
    private IDemoService demoService;

    @MyRequestMapping("/query")
    public String query(HttpServletRequest request, HttpServletResponse response, String name) {
        return demoService.get(name);
    }

    @MyRequestMapping("/query1")
    public String query1(HttpServletRequest request, HttpServletResponse response) {
        return "success";
    }

    @MyRequestMapping("/query2")
    @Security({"zhangsan"})
    public String query2(HttpServletRequest request, HttpServletResponse response){
        return "success";
    }
}
